package edu.ccut.saturn.studio.validate.editor;

import org.eclipse.ui.PartInitException;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.w3c.dom.Document;

import edu.ccut.saturn.studio.core.util.eclipse.SaturnXMLFormEditor;
import edu.ccut.saturn.studio.saturndata.model.ValidateModel;
import edu.ccut.saturn.studio.validate.page.ValidatePage;
public class ValidateEditor extends SaturnXMLFormEditor {

	private static final String VALIDATE_EDITOR_VIEW = "View";
	private ValidateModel validateModel;
	private ValidatePage view;
	
	public static final String SATURN_VALIDATE_EDITOR = ValidateEditor.class
	.getName();

	public ValidateModel getValidateModel() {
		return validateModel;
	}

	public ValidateEditor() {
	}

	protected void initModel() {
		StructuredTextEditor sourcePage = super.getTextEditor();
		validateModel = new ValidateModel((Document) sourcePage
				.getAdapter(Document.class));
	}
	
	/**
	 * 为这个编辑器添加1个页
	 */
	protected void addFormPages() throws PartInitException {
		int i = 0;
		view = new ValidatePage(this);
		addPage(i, view);
		setPageText(i, VALIDATE_EDITOR_VIEW); //$NON-NLS-1$
	}
}